import random
from core.basehandler import BaseHandler
from core.room import Room
from core.action import Action
from util.sessions import Session

class StartingPoint(Room):
    
    def __init__(self, room_id):
        Room.__init__(self, room_id)    # do basic initialization for every room
        
        # build list of actions
        self.add_action(In)
        self.session = Session()    # find or create the session
        '''self.session['target'] = random.randrange(0, 99)'''
        self.session['classroom_exam_1_attempt'] = 0
        self.session['classroom_exam_1_points'] = 0
        self.session['classroom_exam_2_attempt'] = 0
        self.session['classroom_exam_2_points'] = 0
        self.session['cornwalls_visits'] = 0
        self.session['cornwalls_drinks_total'] = 0

        
                  
    
    # return description of room.
    def get_description(self):
        return     '''
        WELCOME TO SMG.
        '''
    # return image of room
    def get_image(self):
        return 'smgoutside.jpg'
         

class StartingPointHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return StartingPoint

# define actions for this room

class In(Action):
    def __init__(self):
        Action.__init__(self, "In")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Go Inside"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'lobby'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"